package 第14届;
import java.util.*;
import java.io.*;
public class G_买二赠一 {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st;
		int n = Integer.parseInt(br.readLine());
		st = new StringTokenizer(br.readLine());
		int arr[] = new int[n];
		int buy[] = new int[n];// 0未用 1购买了 2赠送了
		for(int i = 0 ; i < n ;i++) {
			arr[i] = Integer.parseInt(st.nextToken());
		}
		Arrays.sort(arr);
		
		int i = arr.length - 1;
		int object = 0;
		int price = 0;
		while(i >= 0) {
			// 购买的商品不是2件，就购买到2件为止
			while(object != 2 && i >= 0) {
				// 没买过/没免费获得过，就买
				if(buy[i] == 0) {
					buy[i] = 1;
					i--;
					object++;
					// 计算可免购商品的金额
					if(object == 2) {
						price = arr[i+1] / 2;
					}
				} else {
					i--;
				}
			}

			// 已经买了两件物品了，进行赠一和重置
			for(int j = i + 1; j >= 0; j--) {
				if(arr[j] <= price && buy[j] == 0) {
					buy[j] = 2;
					break;
				}
			}
			object = 0;

		}
		
//		for(int k = 0 ; k < arr.length; k++) {
//			System.out.print(arr[k]);
//		}
//		System.out.println();
//		for(int k = 0 ; k < buy.length; k++) {
//			System.out.print(buy[k]);
//		}
//		System.out.println();
		
		int sum = 0;
		for(int k = 0 ; k < arr.length; k++) {
			if(buy[k] == 1) {
				sum += arr[k];
			}
		}
		System.out.println(sum);
		
	}
}
